
import request from '@/utils/request.js'
export const getArticles = (channelId, timestamp) => {
  return request({
    method: 'GET',
    url: '/v1_1/articles',
    params: {
      channel_id: channelId, // 频道id
      timestamp: timestamp, // 时间戳整数 单位毫秒
      with_top: 1
    }
  })
}
export const dislikeArticle = (articleId) => {
  return request({
    method: 'POST',
    url: '/v1_0/article/dislikes',
    data: {
      target: articleId
    }
  })
}
export const reportArticle = (articleId, type) => {
  return request({
    method: 'POST',
    url: '/v1_0/article/reports',
    data: {
      target: articleId,
      type
    }
  })
}
export const getArticleDetail = id => {
  return request({
    method: 'GET',
    url: `/v1_0/articles/${id}`
  })
}
export const followUser = (userId) => {
  return request({
    method: 'POST',
    url: '/v1_0/user/followings',
    data: {
      target: userId
    }
  })
}
export const unFollowUser = (userId) => {
  return request({
    method: 'DELETE',
    url: `/v1_0/user/followings/${userId}`
  })
}
export const delLike = id => {
  return request({
    method: 'DELETE',
    url: `/v1_0/article/likings/${id}`
  })
}
export const addLike = id => {
  return request({
    method: 'POST',
    url: '/v1_0/article/likings',
    data: {
      target: id
    }
  })
}
